package common.lib.core;

import lombok.Data;


/**
 * @author xiaozefeng
 * @date 12/12/18 1:42 PM
 */
@Data
public class ResultVO<T> {

    private Integer code;

    private String message;

    private T data;

    public ResultVO() {
    }

    private ResultVO(Integer code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }


    public static <T> ResultVO<T> ok(T data) {
        return new ResultVO<>(200, "success", data);
    }

    public static <T> ResultVO<T> ok() {
        return new ResultVO<>(200, "success", null);
    }

    public static <T> ResultVO<T> error(String msg) {
        return new ResultVO<>(500, msg, null);
    }

}
